import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
//import HomeView from '../views/HomeView.vue'
import moLogin from '../views/sysPage/moLogin.vue'
import moMain from  '../layout/moMain.vue'

export const mo_routes: Array<RouteRecordRaw> = [
  {
    path: '/login',
    name: 'login',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: moLogin
  },
  {
    path: '',
    name: '',
    component: moMain,
    redirect: '/login',
    children:[{
      path: 'home',
      name: 'home',
      component: () => import(/* webpackChunkName: "about" */ '../views/sysPage/moHome.vue'),
      meta:{  //? 应该是用户自定义的路由属性
        requiresAuth:true,  //需要进行权限校验
        name:'首页'
      }
    },
    {
      path: 'demo1',
      name: 'demo1',
      component: () => import(/* webpackChunkName: "about" */ '../views/demo/demo1.vue'),
      meta:{  //? 应该是用户自定义的路由属性
        requiresAuth:true,  //需要进行权限校验
        name:'示例1'
      }
    },
    {
      path: 'demo2',
      name: 'demo2',
      component: () => import(/* webpackChunkName: "about" */ '../views/demo/demo2.vue'),
      meta:{  //? 应该是用户自定义的路由属性
        requiresAuth:true,  //需要进行权限校验
        name:'示例2'
      }
    },
    
    
  ]
  },
  {
    path: '/main',
    name: 'main',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/sysPage/moMain.vue')
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes:mo_routes
})

export default router
